//
//  WFtabarViewController.m
//  WangYiFirst
//
//  Created by 蔡靖方 on 16/9/11.
//  Copyright © 2016年 111. All rights reserved.
//

#import "WFtabarViewController.h"
#import "WFLiveViewController.h"
#import "WFmeViewController.h"
#import "WFNewsViewController.h"
#import "WFPoticViewController.h"
#import "WFNavigationBar.h"
@interface WFtabarViewController ()

@end

@implementation WFtabarViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    //self.view.backgroundColor=[UIColor blueColor];
    //新闻业
    WFNewsViewController *vc0=[[WFNewsViewController alloc]init];
    [self addChildViewController:vc0 andTitle:@"新闻" andImage:@"tabBar_essence_click_icon" andSelectededimage:@"tabBar_essence_click_icon"];
    
    //直播业
    WFLiveViewController *vc1=[[WFLiveViewController alloc]init];
    [self addChildViewController:vc1 andTitle:@"直播" andImage:@"tabBar_essence_click_icon" andSelectededimage:@"tabBar_essence_click_icon"];

    //话题
    WFPoticViewController*vc2=[[WFPoticViewController alloc]init];
    [self addChildViewController:vc2 andTitle:@"话题" andImage:@"night_tabbar_icon_bar_normal@2x" andSelectededimage:@"night_tabbar_icon_bar_highlight@2x"];
    
    //我
    //第一种可以通过toeryboard来加载
//    UIStoryboard *story=[UIStoryboard storyboardWithName:@"CJFMyview" bundle:nil];
//    CJFMyViewController *me=  [story instantiateInitialViewController];
    //第二种通过手写
    WFmeViewController *me=[[WFmeViewController alloc]init];
    [self addChildViewController:me andTitle:@"我" andImage:@"tabBar_essence_click_icon" andSelectededimage:@"tabBar_essence_click_icon"];
    
}
-(void)addChildViewController:(UIViewController *)childController andTitle:(NSString *)title andImage:(NSString *)image andSelectededimage:(NSString *)seletedimage{
    
    WFNavigationBar *vcng=[[WFNavigationBar alloc]initWithRootViewController:childController];
    childController.tabBarItem.title=title;
    //    NSMutableDictionary *dict=[NSMutableDictionary dictionary];
    //字体大小 在选中状态下设置无效  只能在默认状态下设置
    [childController.tabBarItem setTitleTextAttributes:@{NSForegroundColorAttributeName:[UIColor blackColor], NSFontAttributeName:[UIFont systemFontOfSize:20]} forState:UIControlStateSelected];
    
    childController.tabBarItem.image=[UIImage imageNamed:image];
    childController.tabBarItem.selectedImage=[[UIImage imageNamed:seletedimage]imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];//不渲染
    //在图片文件夹里可以设置不选然
    [self addChildViewController:vcng];
    
    
}



@end
